﻿using Easy.Common.Helper.JWT;
using Easy.Common.Params;
using Easy.Common.Results;
using Easy.Services.Dtos;
using Easy.Services.Entities;
using System.Linq.Expressions;

namespace Easy.Services.Interface
{
    public interface IUserService
    {

        long Add(User user);

        APIResult Register(LoginDTO dto, string ip);

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="login">实体</param>
        /// <returns>返回结果</returns>
        APIResult Login(LoginDTO login);

        /// <summary>
        /// 记录登录错误信息
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>返回结果</returns>
        APIResult RecordLoginError(string userName);

        /// <summary>
        /// 重置登录信息
        /// </summary>
        /// <param name="user">实体</param>
        /// <returns>返回结果</returns>
        APIResult ResetLoginError(User user);


        User Get(Expression<Func<User, bool>> expression);

        bool Update(User user);


        APIResult GetProfile(TokenModelJwt tokenModel);

        APIResult UpdatePassword(UpdatePasswordDTO dto, TokenModelJwt tokenModel);

        APIResult GetManagerList();

        APIResult GetPage(UserPageParam param);

        APIResult AddUser(User user);

        bool Delete(User user);

        long[] GetRoleIds(long id);

        long GetTotal(Expression<Func<User, bool>> whereExpression = null, bool includeDelete = false);


    }
}
